﻿using System;
using System.Web.UI;

namespace Evolution.UI.WebParts
{
    [Serializable]
    public abstract class BaseAction
    {        
        #region Properties
        
        public abstract string Caption { get; }

        public virtual bool RequireCondition { get; set; }
        
        #endregion

        #region Methods

        public abstract void Execute(Page page, PageActionWebPart part);

        public abstract string GetDescription();

        public virtual bool IsValidAction(PageActionWebPart part, out string errorMessage)
        {
            errorMessage = String.Empty;
            return true;
        }

        public virtual void CreateInterface(ControlCollectionBuilder builder, PageActionEditor editor)
        {
        }

        public virtual void ApplyChanges(PageActionEditor editor)
        {
        }

        public virtual void SyncChanges(PageActionEditor editor)
        {
        }

        #endregion
    }
}
